//
//  TabBarViewController.m
//  renxinghuan
//
//  Created by 王晓民 on 2018/3/19.
//  Copyright © 2018年 吴清翠. All rights reserved.
//

#import "TabBarViewController.h"
#import "WQCHomeViewController.h"
#import "WQCBillViewController.h"
#import "WQCFindViewController.h"
#import "WQCMyViewController.h"
#import "WYCNavigationController.h"
#import "configuration.h"
@interface TabBarViewController ()
{
    UIButton  *saveButton0;
    UIButton  *saveButton1;
    UIButton  *saveButton2;
    UIButton  *saveButton3;

}
@end

@implementation TabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //初始化两个视图控制器
    WQCHomeViewController *oneVc = [[WQCHomeViewController alloc]init];
    WQCBillViewController *twoVc = [[WQCBillViewController alloc]init];
    WQCFindViewController *threeVc = [[WQCFindViewController alloc]init];
    WQCMyViewController *fourVc = [[WQCMyViewController alloc]init];

    //为两个视图控制器添加导航栏控制器
    WYCNavigationController *navOne = [[WYCNavigationController alloc]initWithRootViewController:oneVc];
    WYCNavigationController *navTwo = [[WYCNavigationController alloc]initWithRootViewController:twoVc];
       WYCNavigationController  *findNav = [[WYCNavigationController alloc]initWithRootViewController:threeVc];
        WYCNavigationController  *myNav = [[WYCNavigationController alloc]initWithRootViewController:fourVc];

    
    //设置控制器文字
    navOne.title = @"首页";
    navTwo.title = @"账单";
//    findNav.title = @"发现";
    myNav.title = @"我的";
    
    //设置控制器图片(使用imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal,不被系统渲染成蓝色)
    navOne.tabBarItem.image = [[UIImage imageNamed:@"icon_home_bottom_main"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    navOne.tabBarItem.selectedImage = [[UIImage imageNamed:@"icon_home_bottom_main_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    navTwo.tabBarItem.image = [[UIImage imageNamed:@"icon_home_bottom_search"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    navTwo.tabBarItem.selectedImage = [[UIImage imageNamed:@"icon_home_bottom_search_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
//    findNav.tabBarItem.image = [[UIImage imageNamed:@"icon_home_bottom_find"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//    findNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"icon_home_bottom_find_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    myNav.tabBarItem.image = [[UIImage imageNamed:@"icon_home_bottom_my"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    myNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"icon_home_bottom_my_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    
    //改变tabbarController 文字选中颜色(默认渲染为蓝色)
    [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor lightGrayColor]} forState:UIControlStateNormal];
    [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:RGB(0, 140, 222, 1)} forState:UIControlStateSelected];
    
    //创建一个数组包含四个导航栏控制器
    NSArray *vcArry = [NSArray arrayWithObjects:navOne,navTwo,myNav,nil];
    
    //将数组传给UITabBarController
    self.viewControllers = vcArry;

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
